package com.tqyan.model.exp;

import com.tqyan.model.Result;
import lombok.EqualsAndHashCode;

/**
 * @description 默认异常
 * <p> <功能详细描述> </p>
 *
 * @author 陈晨
 * @date 2023/4/12 01:29
 */
@EqualsAndHashCode(callSuper = true)
public class DefaultException extends RuntimeException {
    private static final long serialVersionUID = 777396999051709962L;

    private final String errorCode;
    private final String message;

    public DefaultException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
        this.message = message;
    }

    public DefaultException(String message) {
        this("500", message);
    }

    public DefaultException(Result result) {
        this(result.getCode(), result.getMessage());
    }

    public String getErrorCode() {
        return this.errorCode;
    }

}


